package java02;

import java.util.Arrays;

public class zy02 {
	public static void main(String[] args){
		int[] a = new int[] {1,5,2,3,6,9,4,0,8};
		
		for(int gap = a.length / 2; gap > 0; gap /= 2) {
			for(int i = gap; i < a.length; i++) {
				for(int j = i - gap; j >= 0; j -= gap) {
					if(a[j] > a[j + gap]) {
						int temp = a[j];
						a[j] = a[j + gap];
						a[j + gap] = temp;
					}
				}
			}
		}
		System.out.println(Arrays.toString(a));
	


	}
}
